<!--
 * @Description: 你的代码我的心
 * @Author: GGB
 * @Date: 2022-01-24 15:15:54
 * @LastEditors: GGB
 * @LastEditTime: 2022-01-25 10:25:22
-->
<!--
 * @Description: 你的代码我的心
 * @Author: GGB
 * @Date: 2022-01-24 15:11:23
 * @LastEditors: GGB
 * @LastEditTime: 2022-01-25 10:14:13
-->
<template>
  <PageWrapper contentBackground contentClass="flex" fixedHeight>
    <BasicTable @register="registerTable">
      <template #img="{ record }">
        <TableImg :imgList="[record.goods_image]" :size="50" />
      </template>
      <template #action="{ record }">
        <TableAction
          :actions="[
            {
              label: '撤回',
              popConfirm: {
                title: '是否撤回商城',
                confirm: handleBack.bind(null, record),
              },
            },
          ]"
        />
      </template>
    </BasicTable>
  </PageWrapper>
</template>
<script lang="ts" setup>
  import { BasicTable, useTable, TableAction, TableImg, FetchSetting } from '/@/components/Table';
  import { PageWrapper } from '/@/components/Page';
  import { getRecoveryList } from '/@/api/store';
  import { columns } from '../store.data';
  const [registerTable] = useTable({
    title: '商城回收站列表',
    api: getRecoveryList,
    fetchSetting: {
      sizeField: 'pageSize',
      // // 请求接口当前页数
      pageField: 'page',
      // 请求结果列表字段  支持 a.b.c
      listField: 'list.data',
      // 请求结果总数字段  支持 a.b.c
      totalField: 'list.total',
    } as FetchSetting,
    columns,
    useSearchForm: false,
    showTableSetting: true,
    bordered: true,
    showIndexColumn: false,
    actionColumn: {
      width: 80,
      title: '操作',
      dataIndex: 'action',
      slots: { customRender: 'action' },
      fixed: undefined,
    },
  });
  // 删除商城
  const handleBack = () => {
    // let param = {
    //   storeId: record.store_id,
    // } as DeleteStoreParams;
    // setLoading(true);
    // addRecovery(param)
    //   .then(({ message }) => {
    //     createMessage.success(message);
    //     reload();
    //   })
    //   .finally(() =>setLoading(false));
  };
</script>
